home *** CD-ROM | disk | FTP | other *** search
- Path: mother.usf.edu!news
- From: yatesc@csee.usf.edu (Randy Yates)
- Newsgroups: comp.sources.wanted,comp.lang.c,comp.unix.programmer
- Subject: Re: Seek unix2dos.c OR help with tr - unix2dos.zip [0/3]
- Date: 15 Mar 1996 17:56:01 GMT
- Organization: University of South Florida
- Distribution: ibm
- Message-ID: <4icavh$oiv@mother.usf.edu>
- References: <4i0946$7io@nuke.csu.net> <4i1g2v$m12@watnews1.watson.ibm.com>
- NNTP-Posting-Host: ppp174.cfr.usf.edu
- Mime-Version: 1.0
- Content-Type: message/partial;
- id="826923680@Randy Yates";
- number=1; total=4
- X-Newsreader: WinVN 0.93.14
-
- Content-Type: multipart/mixed;
- Boundary="*-*-*- Next Section -*-*-*"
-
- --*-*-*- Next Section -*-*-*
-
- In article <4i1g2v$m12@watnews1.watson.ibm.com>, kgold@watson.ibm.com
- says...
- >
- > mclean@futon.SFSU.EDU (Emmett Mclean) writes:
- >|>
- >|> Does anyone have the source to a program
- >|> converting a unix file into dos format?
- >|> That is, each decimal 10 char is replaced
- >|> with a series of a 10 and 13.
- >|>
- >|>[snip]
- >|>
- >|> I will be using it to download zipped binaries
- >|> files from a unix box.
- >|>
- >|> Ah, writing the program is a bit trickier
- >|> than the little program below since the
- >|> program exits prematurely because getchar reads
- >|> EOF from its input - before getting to
- >|> the real EOF.
- >|>
- >|> #include <stdio.h>
- >|> main(){
- >|> char c;
- >|> while(EOF!=(c=getchar())){
- >|> if(10==c)putchar(13);
- >|> putchar(c);
- >|> }
- >|> putchar(10);
- >|> }
- >|>
- >
- >The tricky part is that getchar() returns an int, not a char.
- >It does that so EOF does not collide with a legal 8 bit char.
- >
- >BTW, if you're using an AIX machine, aix2dos and dos2aix are
- >included and do exactly what you want.
- >
- >--
- >Ken Goldman kgold@watson.ibm.com 914-784-7396
-
- --
- % Randy Yates % "...the answer lies within your soul
- % EE/Mathematics Student % 'cause no one knows which side
- % University of South Florida % the coin will fall."
- % <yatesc@csee.usf.edu> % 'Big Wheels', *Out of the Blue*, ELO
- --*-*-*- Next Section -*-*-*
-
-